package com.su.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.su.tools.DaoSupport1;
import com.su.tools.PageData;

import net.sf.json.JSONObject;

@Service("indexService")
public class IndexService {
	
	@Resource(name = "daoSupport1")
	private DaoSupport1 dao;
	private JSONObject json = new JSONObject();
	private PageData retPd;
	private List<PageData> retListPd;
	
	public JSONObject invoke(PageData pd) throws Exception {

		if (pd.getString("params").equals("I101")) {
			this.I101(pd);
		} else {
			json.put("code", "100");
			json.put("msg", "没有找到该业务代码");
			return json;
		}
		return json;
	}
	/**
	 * 获取用户菜单列表
	 * 
	 * @param pd
	 * @throws Exception
	 */
	public void I101(PageData pd) throws Exception {
		retListPd = dao.getList("MenuMapper.getUserMenu", pd);
		if (retListPd.size() == 0) {
			json.put("code", "1");
			json.put("msg", "没有查询到数据");
		} else {
			json.put("total", retListPd.size());
			json.put("rows", retListPd);
		}
	}

}
